﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TeacherHelp.Public;

namespace TeacherHelp.ViewModel
{
    public class TestInfo : Model.TestInfo
    {
        public string Content { get; set; }
        public string Aoption { get; set; }
        public string Boption { get; set; }
        public string Coption { get; set; }
        public string Doption { get; set; }

        public ExercisesType exercisesType
        {
            get
            {
                if (!string.IsNullOrWhiteSpace(Answer))
                {
                    if (Answer.Split(',').Length <= 1)
                    {
                        if (string.IsNullOrWhiteSpace(Coption) && string.IsNullOrWhiteSpace(Doption))
                        {
                            return ExercisesType.判断题;
                        }
                        else
                        {
                            return ExercisesType.单选题;
                        }
                    }
                    else
                    {
                        return ExercisesType.多选题;
                    }
                }
                throw new Exception($"获取题目类型出现异常! \n Answer(答案)为：{Answer} \n Coption为：{Coption} \n Doption为：{Doption}");
            }
        }
    }
}
